//
//  NextViewController.m
//  17-通讯录数据持久化
//
//  Created by 殷殷明静 on 16/8/5.
//  Copyright © 2016年 YMJ. All rights reserved.
//

#import "NextViewController.h"

@interface NextViewController ()<UITextFieldDelegate>
- (IBAction)actionBtn:(id)sender;
@property (weak, nonatomic) IBOutlet UIButton *btn;

@end

@implementation NextViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.text1.text = _nextMate.name;
    self.text2.text = [_nextMate.age description];
    self.text3.text = _nextMate.gender;
    self.text4.text = _nextMate.phoneNumber;
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
    [textField resignFirstResponder];
    return YES;
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

- (IBAction)actionBtn:(id)sender {
    _nextMate = [[NewContacter alloc] initWithName:_text1.text age:@([_text2.text integerValue]) gender:_text3.text phoneNumber:_text4.text];
    self.block(_nextMate);
    [self.navigationController popViewControllerAnimated:YES];
}
@end
